package rd.hardcore.ui.config.nav 
{
	import aze.motion.eaze;
	import flash.display.MovieClip;
	import flash.events.MouseEvent;
	import flash.text.TextFieldAutoSize;
	
	/**
	 * ...
	 * @author Romain
	 */
	public class NavItem extends NavItem_FC
	{
		private var _id : String;
		
		public function NavItem() 
		{
			mouseChildren = false;
			buttonMode = true;
			
			tf.autoSize = TextFieldAutoSize.LEFT;
			tf.mouseWheelEnabled = false;
			
			addEventListener(MouseEvent.ROLL_OVER, 	handleOver);
			addEventListener(MouseEvent.ROLL_OUT, 	handleOut);
		
		}
		
		public function build( _xml : XML ) : void
		{
			tf.htmlText = _xml.toString();
			_id = _xml.@id;
		}
		
		public function get ID() : String
		{
			return _id;
		}

		
		public function select() : void
		{
			mouseEnabled = false;	
			
			removeEventListener(MouseEvent.ROLL_OVER, 	handleOver);
			removeEventListener(MouseEvent.ROLL_OUT, 	handleOut);
			
			//eaze(selectedShape).to(.4, { alpha : 1  } );
			eaze(this).to(.3, { alpha:.6 } );
		}
		
		public function unselect() : void
		{
			mouseEnabled = true;
			
			//eaze(selectedShape).to(.3, { alpha : 0  } );
			handleOut();
			addEventListener(MouseEvent.ROLL_OVER, 	handleOver);
			addEventListener(MouseEvent.ROLL_OUT, 	handleOut);
		}
		
		private function handleOver(e:MouseEvent=null):void 
		{
			eaze(this).to(.3, { alpha:.7 } );
		}
		
		private function handleOut(e:MouseEvent=null):void 
		{
			eaze(this).to(.3, { alpha:1 } );
		}

		
	}

}